class AssignmentController < ApplicationController
layout "office", :except => [:new, :edit] 
active_scaffold :assignments do | config | 
config.list.columns = [:id, :assignment_template_id, :date_of_acceptance, :target_date_of_completion ]
end

  #def index
   # list
    #render :action => 'list'
  #end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  #verify :method => :post, :only => [ :destroy, :create, :update ],
   #      :redirect_to => { :action => :list }

#  def list
 #   @assignment_pages, @assignments = paginate :assignments, :per_page => 10
  #end

  #def show
   # @assignment = Assignment.find(params[:id])
  #end

  def new
    @assignment = Assignment.new
  end

  def create
    @assignment = Assignment.new(params[:assignment])
    if @assignment.save
      flash[:notice] = 'Assignment was successfully created.'
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @assignment = Assignment.find(params[:id])
  end

  def update
    @assignment = Assignment.find(params[:id])
    if @assignment.update_attributes(params[:assignment])
      flash[:notice] = 'Assignment was successfully updated.'
      redirect_to :action => 'list'
      #redirect_to :action => 'show', :id => @assignment
    else
      render :action => 'edit'
    end
  end

  def destroy
    Assignment.find(params[:id]).destroy
    redirect_to :action => 'list'
  end
end
